<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Nota extends Level_2_Auth {
	function __construct()
	{
		parent::__construct();
		$this -> load -> model('nota_model','',TRUE);
		$this -> load -> model('unit_model','',TRUE);
	}

	function index()
	{
		$this -> data['result'] = $this -> nota_model -> getData();
		$this -> data['unit'] = $this -> unit_model -> getUnit(); # get all unit from table unit in database

		# this code will create an array filled with distinct value
		$temp_kode_harga = "";
		$array = array();
		foreach ($this -> data['cabang'] as $row) {
			if($row['kode_harga'] != $temp_kode_harga) {
				$temp_array = array(
					'kode_harga' => $row['kode_harga']
				);
				array_push($array, $temp_array);
				$temp_kode_harga = $row['kode_harga'];
			}
		}
		$this -> data['harga'] = $array;
		# above code will create an array filled with distinct value

		$this -> data['contents'] = $this -> load -> view('nota_view',$this -> data,true);
		$this -> data['page_title'] = 'Twin Tulipware - Nota';
		$this -> load -> view('template_default',$this -> data);
	}
}
?>

